<?php
$this->breadcrumbs = array(
    'Testimonies',
);
?>

<h1>Testimonies</h1>

<p>
    <strong>Dear Customer:</strong><br/>
    You can use this page to send us feedback regarding the Runescape2007gold.com services.
</p>

<?php
$this->widget('zii.widgets.CListView', array(
    'dataProvider' => $model->search(),
    'itemView' => '_view',
    'itemsTagName' => 'dl',
    'itemsCssClass' => 'gbooks',
    'template' => '{pager}{items}{pager}',
    'ajaxUpdate' => FALSE,
    'pagerCssClass' => 'pagination',
    'pager' => array(//通过pager设置样式   默认为CLinkPager
        'cssFile' => '',
        'prevPageLabel' => '<<',
        'nextPageLabel' => '>>',
        'header' => '',
        'maxButtonCount' => 8,
        'htmlOptions' => array('class' => 'pull-right'),
    ),
));
?>

<?php
if (Yii::app()->user->isGuest):
    $form = $this->beginWidget('CActiveForm', array(
        'id' => 'web-guestbook-form',
        'enableAjaxValidation' => false,
            ));
    ?>
    <div class="input-prepend">
        <span class="add-on">Title: </span>
        <?php echo $form->textField($model, 'title', array('class' => 'span4')); ?>
    </div>
    <div class="clearfix"></div>
    <div>
        Content:<br/>
        <?php echo $form->textArea($model, 'content', array('rows' => '3', 'cols' => 60, 'class' => 'span5')); ?>
    </div>
    <div>
        <?php echo CHtml::submitButton('Submit', array('class' => 'btn', 'id' => 'estimate', 'onclick' => 'return checkSubmit()')); ?>
    </div>
        <?php
        $this->endWidget();
    else:
        echo 'You need to ' . CHtml::link('Login', Yii::app()->createAbsoluteUrl('site/login')) . ' to Write Feedback!';
    endif;
    ?>

    <script>
        $(function() {
            $("#estimate").click(function() {
                var dd = "<?php echo Yii::app()->user->isGuest ?>";
                if (dd) {
                    alert("Please Login");
                    return false;
                }
                if ($("#WebGuestbook_title").val() == "") {
                    alert("Title can't be empty");
                    return false;
                }

                if ($("#WebGuestbook_content").val() == "") {
                    alert("Content can't be empty");
                    return false;
                }
            });
        });
    </script>